document.writeln("<link href=\"\/css\/common\/dialog.css\" rel=\"stylesheet\" type=\"text\/css\" \/>");
///-------------------------------------------------------------------------
//jQuery弹出窗口 By Await [2009-11-22]
//--------------------------------------------------------------------------
/*参数：[可选参数在调用时可写可不写,其他为必写]
----------------------------------------------------------------------------
    title:	窗口标题
  content:  内容(可选内容为)
    width:	内容宽度
   height:	内容高度
	 drag:  是否可以拖动(ture为是,false为否)
     time:	自动关闭等待的时间，为空是则不自动关闭
   showbg:	[可选参数]设置是否显示遮罩层(false为不显示,true为显示)
  cssName:  [可选参数]附加class名称
 ------------------------------------------------------------------------*/
 //示例:
 //------------------------------------------------------------------------
 //syWindown("例子","例子","500","400","true","3000","0","exa")
 //------------------------------------------------------------------------
 /*
		<div id="bodyDialog" style="height: 780px;"></div>
		<div id="dialog_all">
			<div id="dialog_title">
				<div id="dialog_title_left">提示</div>
				<span id="dialog_title_close">关闭</span>
			</div>
			<div id="dialog_content">
				<div class="tscontent">您的密保设置有风险，请重新设置。</div>
				<div class="tslink"><a href="#">立刻设置</a><span class="nextsay" onclick="closeSydialog();">下次再说</span></div>
			</div>
		</div>  */

var showWindown = true;
function syWindown(title,content,width,height,drag,time,showbg,cssName) {
	$("#bodyDialog").remove(); //请除内容
	$("#dialog_all").remove(); //请除内容
	var width = width>= 950?this.width=950:this.width=width;	    //设置最大窗口宽度
	var height = height>= 527?this.height=527:this.height=height;  //设置最大窗口高度
	if(showWindown == true) {
		var simpleWindown_html = new String;
			var _version = $.browser.version;
			if(_version == 6.0){
				simpleWindown_html = "<iframe id=\"bodyDialogIframe\" style=\"height:"+$(document).height()+"px;\"></iframe><div id=\"bodyDialog\" style=\"height:"+$(document).height()+"px;\"></div>";
			}else{
				simpleWindown_html = "<div id=\"bodyDialog\" style=\"height:"+$(document).height()+"px;\"></div>";
			}
			
			simpleWindown_html += "<div id=\"dialog_all\">";
			simpleWindown_html += "<div id=\"dialog_title\"><div id=\"dialog_title_left\"></div><span id=\"dialog_close\">关闭</span></div>";
			simpleWindown_html += "<div id=\"dialog_content\"></div>"; 
			simpleWindown_html += "</div>";
			$("body").append(simpleWindown_html);
			show = false;
	}
	$("#dialog_content").html(content);
	$("#dialog_title_left").html(title);
	if(showbg == "true") {$("#bodyDialog").show();}else {$("#bodyDialog").remove();};
	$("#bodyDialog").animate({opacity:"0.5"},"normal");//设置透明度
	$("#dialog_all").show();
	if( height >= 527 ) {
		$("#dialog_title").css({width:(parseInt(width)+22)+"px"});
		$("#dialog_content").css({width:(parseInt(width)+17)+"px",height:height+"px"});
	}else {
		$("#dialog_title").css({width:(parseInt(width)+10)+"px"});
		$("#dialog_content").css({width:width+"px",height:height+"px"});
	}
	var	cw = document.documentElement.clientWidth,ch = document.documentElement.clientHeight,est = document.documentElement.scrollTop; 
	$("#dialog_all").css({left:"50%",top:(parseInt((ch)/2)+est)+"px",marginTop: -((parseInt(height)+53)/2)+"px",marginLeft:-((parseInt(width)+32)/2)+"px",zIndex: "999999"});
	var Drag_ID = document.getElementById("dialog_all"),DragHead = document.getElementById("dialog_title");
		
	var moveX = 0,moveY = 0,moveTop,moveLeft = 0,moveable = false;
		if ( _version == 6.0 ) {
			moveTop = est;
		}else {
			moveTop = 0;
		}
	var	sw = Drag_ID.scrollWidth,sh = Drag_ID.scrollHeight;
		DragHead.onmouseover = function(e) {
			if(drag == "true"){DragHead.style.cursor = "move";}else{DragHead.style.cursor = "default";}
		};
		DragHead.onmousedown = function(e) {
		if(drag == "true"){moveable = true;}else{moveable = false;}
		e = window.event?window.event:e;
		var ol = Drag_ID.offsetLeft, ot = Drag_ID.offsetTop-moveTop;
		moveX = e.clientX-ol;
		moveY = e.clientY-ot;
		document.onmousemove = function(e) {
				if (moveable) {
				e = window.event?window.event:e;
				var x = e.clientX - moveX;
				var y = e.clientY - moveY;
					if ( x > 0 &&( x + sw < cw) && y > 0 && (y + sh < ch) ) {
						Drag_ID.style.left = x + "px";
						Drag_ID.style.top = parseInt(y+moveTop) + "px";
						Drag_ID.style.margin = "auto";
						}
					}
				}
		document.onmouseup = function () {moveable = false;};
		Drag_ID.onselectstart = function(e){return false;}
	}
	$("#dialog_content").attr("class","dialog_"+cssName);
	var closeWindown = function() {
		if ( _version == 6.0 ) {
			$("#bodyDialogIframe").remove();
		}
		$("#bodyDialog").remove();
		$("#dialog_all").fadeOut("slow",function(){$(this).remove();});
	}
	if( time == "" || typeof(time) == "undefined") {
		$("#dialog_close").click(function() {
			if ( _version == 6.0 ) {
				$("#bodyDialogIframe").remove();
			}
			$("#bodyDialog").remove();
			$("#dialog_all").fadeOut("slow",function(){$(this).remove();});
		});
	}else { 
		setTimeout(closeWindown,time);
	}
}
function closeSydialog(){
	var _versionc = $.browser.version;
	if ( _versionc == 6.0 ) {
		$("#bodyDialogIframe").remove();
	}
	$("#bodyDialog").remove();
	$("#dialog_all").fadeOut("slow",function(){$(this).remove();});
}

function syWindownDialog(content,width,height,drag,time,showbg,cssName) {
	$("#bodyDialog").remove(); //请除内容
	$("#dialog_tishiall").remove(); //请除内容
	var width = width>= 950?this.width=950:this.width=width;	    //设置最大窗口宽度
	var height = height>= 527?this.height=527:this.height=height;  //设置最大窗口高度
	if(showWindown == true) {
		var simpleWindown_html = new String;
		var _version = $.browser.version;
		if(_version == 6.0){
			simpleWindown_html = "<iframe id=\"bodyDialogIframe\" style=\"height:"+$(document).height()+"px;\"></iframe><div id=\"bodyDialog\" style=\"height:"+$(document).height()+"px;\"></div>";
		}else{
			simpleWindown_html = "<div id=\"bodyDialog\" style=\"height:"+$(document).height()+"px;\"></div>";
		}
		simpleWindown_html += "<div id=\"dialog_tishiall\">";
		simpleWindown_html += "<div id=\"dialog_tishicontent\"></div>"; 
		simpleWindown_html += "</div>";
		$("body").append(simpleWindown_html);
		show = false;
	}
	$("#dialog_tishicontent").html(content);
	if(showbg == "true") {$("#bodyDialog").show();}else {$("#bodyDialog").remove();};
	$("#bodyDialog").animate({opacity:"0.5"},"normal");//设置透明度
	$("#dialog_tishiall").show();
	if( height >= 527 ) {
		$("#dialog_tishicontent").css({width:(parseInt(width)+17)+"px",height:height+"px"});
	}else {
		$("#dialog_tishicontent").css({width:width+"px",height:height+"px"});
	}
	var	cw = document.documentElement.clientWidth,ch = document.documentElement.clientHeight,est = document.documentElement.scrollTop; 
	
	$("#dialog_tishiall").css({left:"50%",top:(parseInt((ch)/2)+est)+"px",marginTop: -((parseInt(height)+53)/2)+"px",marginLeft:-((parseInt(width)+32)/2)+"px",zIndex: "999999"});
	var Drag_ID = document.getElementById("dialog_tishiall"),DragHead = document.getElementById("dialog_tishicontent");
		
	var moveX = 0,moveY = 0,moveTop,moveLeft = 0,moveable = false;
		if ( _version == 6.0 ) {
			moveTop = est;
		}else {
			moveTop = 0;
		}
	var	sw = Drag_ID.scrollWidth,sh = Drag_ID.scrollHeight;
		DragHead.onmouseover = function(e) {
			if(drag == "true"){DragHead.style.cursor = "move";}else{DragHead.style.cursor = "default";}
		};
		DragHead.onmousedown = function(e) {
		if(drag == "true"){moveable = true;}else{moveable = false;}
		e = window.event?window.event:e;
		var ol = Drag_ID.offsetLeft, ot = Drag_ID.offsetTop-moveTop;
		moveX = e.clientX-ol;
		moveY = e.clientY-ot;
		document.onmousemove = function(e) {
				if (moveable) {
				e = window.event?window.event:e;
				var x = e.clientX - moveX;
				var y = e.clientY - moveY;
					if ( x > 0 &&( x + sw < cw) && y > 0 && (y + sh < ch) ) {
						Drag_ID.style.left = x + "px";
						Drag_ID.style.top = parseInt(y+moveTop) + "px";
						Drag_ID.style.margin = "auto";
						}
					}
				}
		document.onmouseup = function () {moveable = false;};
		Drag_ID.onselectstart = function(e){return false;}
	}
	$("#dialog_tishicontent").attr("class","dialog_"+cssName);
	var closeWindown = function() {
		if ( _version == 6.0 ) {
			$("#bodyDialogIframe").remove();
		}
		$("#bodyDialog").remove();
		$("#dialog_tishiall").fadeOut("slow",function(){$(this).remove();});
	}
	if( time == "" || typeof(time) == "undefined") {
		$("#dialog_tishiclose").click(function() {
			if ( _version == 6.0 ) {
				$("#bodyDialogIframe").remove();
			}
			$("#bodyDialog").remove();
			$("#dialog_tishiall").fadeOut("slow",function(){$(this).remove();});
		});
	}else { 
		setTimeout(closeWindown,time);
	}
}


function closeDialog(){
	var _versionc = $.browser.version;
	if ( _versionc == 6.0 ) {
		$("#bodyDialogIframe").remove();
	}
	$("#bodyDialog").remove();
	$("#dialog_syall").fadeOut("slow",function(){$(this).remove();});
}
function showMessage(title) {
	syMessage(title,240,68,"false","1500","true","msg");
}
function showMessage2(title,drag,time,showbg) {
	syMessage(title,240,68,drag,time,showbg,"msg");
}
function submitDialog(title) {
	syMessage(title,240,68,"false","","true","submitmsg");
}

function syMessage(title,width,height,drag,time,showbg,contentType) {
	$("#bodyDialog").remove(); //请除内容
	$("#dialog_syall").remove(); //请除内容
	var width = width>= 950?this.width=950:this.width=width;	    //设置最大窗口宽度
	var height = height>= 527?this.height=527:this.height=height;  //设置最大窗口高度
	if(showWindown == true) {
		var simpleWindown_html = new String;
			var _version = $.browser.version;
			if(_version == 6.0){
				simpleWindown_html = "<iframe id=\"bodyDialogIframe\" style=\"height:"+$(document).height()+"px;\"></iframe><div id=\"bodyDialog\" style=\"height:"+$(document).height()+"px;\"></div>";
			}else{
				simpleWindown_html = "<div id=\"bodyDialog\" style=\"height:"+$(document).height()+"px;\"></div>";
			}
			simpleWindown_html += "<div id=\"dialog_syall\">";
			simpleWindown_html += "<div id=\"dialog_sytitle\">";
			simpleWindown_html += "</div>";
			simpleWindown_html += "</div>";
			$("body").append(simpleWindown_html);
			show = false;
	}
	var reg=new RegExp("\\.","g");
	var newstitle = title.replace(reg,"");
	if(newstitle.length>11){
		$("#dialog_sytitle").css({"line-height":"24px"});
	}else{
		$("#dialog_sytitle").css({"line-height":"48px"});
	}
	switch(contentType){
		case "msg":
		$("#dialog_sytitle").html("温馨提示："+title+"!");
		break;
		case "submitmsg":
		$("#dialog_sytitle").html(title);
		break;
	}
	if(showbg == "true") {$("#bodyDialog").show();}else {$("#bodyDialog").remove();};
	$("#dialog_syall").show();
	
	if( height >= 527 ) {
		$("#dialog_sytitle").css({width:(parseInt(width)+22)+"px"});
	}else {
		$("#dialog_sytitle").css({width:parseInt(width)+"px"});
	}
	var	cw = document.documentElement.clientWidth,ch = document.documentElement.clientHeight,est = document.documentElement.scrollTop; 
	$("#dialog_syall").css({left:"50%",top:(parseInt((ch)/2)+est)+"px",marginTop: -((parseInt(height)+53)/2)+"px",marginLeft:-((parseInt(width)+32)/2)+"px",zIndex: "999999"});
	var Drag_ID = document.getElementById("dialog_syall"),DragHead = document.getElementById("dialog_sytitle");
		
	var moveX = 0,moveY = 0,moveTop,moveLeft = 0,moveable = false;
		if ( _version == 6.0 ) {
			moveTop = est;
		}else {
			moveTop = 0;
		}
	var	sw = Drag_ID.scrollWidth,sh = Drag_ID.scrollHeight;
		DragHead.onmouseover = function(e) {
			if(drag == "true"){DragHead.style.cursor = "move";}else{DragHead.style.cursor = "default";}
		};
		DragHead.onmousedown = function(e) {
		if(drag == "true"){moveable = true;}else{moveable = false;}
		e = window.event?window.event:e;
		var ol = Drag_ID.offsetLeft, ot = Drag_ID.offsetTop-moveTop;
		moveX = e.clientX-ol;
		moveY = e.clientY-ot;
		document.onmousemove = function(e) {
				if (moveable) {
				e = window.event?window.event:e;
				var x = e.clientX - moveX;
				var y = e.clientY - moveY;
					if ( x > 0 &&( x + sw < cw) && y > 0 && (y + sh < ch) ) {
						Drag_ID.style.left = x + "px";
						Drag_ID.style.top = parseInt(y+moveTop) + "px";
						Drag_ID.style.margin = "auto";
						}
					}
				}
		document.onmouseup = function () {moveable = false;};
		Drag_ID.onselectstart = function(e){return false;}
	}
	var closeWindown = function() {
		if ( _version == 6.0 ) {
			$("#bodyDialogIframe").remove();
		}
		$("#bodyDialog").remove();
		$("#dialog_syall").fadeOut("slow",function(){$(this).remove();});
	}
	if( time == "" || typeof(time) == "undefined") {
	}else { 
		window.setTimeout(closeWindown,time);
	}
}


/*DIV属性*/
	var t_DiglogX,t_DiglogY,t_DiglogW,t_DiglogH;  
	var maxtop,maxright,t_Diglogwidth,t_Diglogheight;//定义移动位置限制
    /*编码*/
	function StrCode(str){    
	  if(encodeURIComponent)     
	    return encodeURIComponent(str);    
	  if(escape)     
	    return escape(str);    
	} 

    /*判断浏览器*/
	function Browser(){    
	  var ua, s, i;    
	  this.isIE = false;    
	  this.isNS = false;    
	  this.isOP = false;    
	  this.isSF = false;    
	  ua = navigator.userAgent.toLowerCase();    
	  s = "opera";    
	  if ((i = ua.indexOf(s)) >= 0){    
	    this.isOP = true;return;    
	  }    
	  s = "msie";    
	  if ((i = ua.indexOf(s)) >= 0) {    
	    this.isIE = true;    
	    return;    
	  }    
	  s = "netscape6/";    
	  if ((i = ua.indexOf(s)) >= 0) {    
	    this.isNS = true;    
	    return;    
	  }    
	  s = "gecko";    
	  if ((i = ua.indexOf(s)) >= 0) {    
	    this.isNS = true;    
	    return;    
	  }    
	  s = "safari";    
	  if ((i = ua.indexOf(s)) >= 0) {    
	    this.isSF = true;    
	    return;    
	  }    
	}   
	
	/*定位DIV*/
	function DialogLoc(){    
	  var dde = document.documentElement; 
	  if (isFirefox=navigator.userAgent.indexOf("Firefox")>0){  
	    var ww = window.innerWidth; //body的可视宽度    
	    var wh = window.innerHeight; //body的可视高度   
	    var bgX = window.pageXOffset;//body的滚动宽度     
	    var bgY = window.pageYOffset; //body的滚动高度 
	  }else{ 
	    var ww = dde.offsetWidth; //body的可视宽度   
	    var wh = dde.offsetHeight; //body的可视高度   
	    var bgX = dde.scrollLeft; //body的滚动宽度   
	    var bgY = dde.scrollTop;//body的滚动高度
	  }    
	  t_DiglogX = ((ww - t_Diglogwidth)/2)+bgX;//DIV 离左边的绝对距离
	  t_DiglogY = ((wh - t_Diglogheight)/2)+bgY;//DIV 离上面的据对距离
	  //maxtop=wh-(t_Diglogheight+(bgY + ((wh - t_DiglogH)/2)))-5;//定义IDV向上下移动的基准宽度 5为增量
	  maxright=ww-(t_Diglogwidth+(bgX + ((ww - t_DiglogX)/2)))-5;//定义IDV向左右移动的基准宽度 5为增量
	} 
	
	//生成对话框
	function DialogShowMessage(showdata,w,h){
	 var objDialog = document.getElementById("DialogMove"); //定义一个固定DIV
	  if (!objDialog){     
	  objDialog = document.createElement("div");    
	  } 
	  t_Diglogwidth=w;//弹出DIV宽度
	  t_Diglogheight=h;//弹出DIV高度
	  objDialog.id = "DialogMove";  
	  DialogLoc();//DIV定位    
	  var oS = objDialog.style;    
	  oS.display = "block";  
	  oS.top = t_DiglogY + "px";    
	  oS.left = t_DiglogX + "px";  
	  oS.margin = "0px";    
	  oS.padding = "0px";    
	  oS.width = 500 + "px";    
	  oS.height = 500 + "px";    
	  oS.position = "absolute"; 
	  oS.zIndex = "10";
	  objDialog.innerHTML = showdata;
	  document.body.appendChild(objDialog);
	}
	
	/*生成DIV*/
	function DialogShow(showdata,w,h){   
	  var objDialog = document.getElementById("DialogMove"); 
	  if (!objDialog){     
	  objDialog = document.createElement("div");   
	  t_Diglogwidth=w;//弹出DIV宽度
	  t_Diglogheight=h;//弹出DIV高度
	  objDialog.id = "DialogMove";   
	  } 
	  DialogLoc();    
	  var oS = objDialog.style;    
	  oS.display = "block";  
	  //alert(t_DiglogY+"======="+t_DiglogX);  
	  oS.top = t_DiglogY + "px";    
	  oS.left = t_DiglogX + "px";  
	  oS.margin = "0px";    
	  oS.padding = "0px";    
	  oS.width = w + "px";    
	  oS.height = h + "px";    
	  oS.position = "absolute";    
	  oS.zIndex = "10"; 
	  objDialog.innerHTML = showdata;
	  document.body.appendChild(objDialog);
	}
	
    //关闭DIV
	function close(){
	 document.getElementById("DialogMove").style.display="none";
	 document.getElementById("DialogMove").innerHTML ="";
	 document.getElementById("DialogMove").parentNode.removeChild(document.getElementById("DialogMove"));
	}
	
	/*生成模态*/
	function ScreenConvert(){   
	  var browser = new Browser();  
	  var objScreen = document.getElementById("ScreenOver");    
	  var wh;
	  if(!objScreen){     
	  	objScreen = document.createElement("div"); 
	  }
	  var oS = objScreen.style;   
	  objScreen.id = "ScreenOver";    
	  oS.display = "block";    
	  oS.top = oS.left = oS.margin = oS.padding = "0px";  
	  if (document.all)   {   
	    wh = document.body.clientHeight +100+ "px";  
	  }else {    
	    wh = document.getElementById("viewBody").clientHeight+100+"px"; 
	  }  
	  oS.width = "100%"; 
	  oS.height = wh;  
	  oS.position = "absolute";    
	  oS.zIndex = "8";     
	  if ((!browser.isSF) && (!browser.isOP)){    
	    oS.background = "#CCCCCC";    
	  }else{    
	    oS.background = "#CCCCCC";    
	  }   
	  oS.filter = "alpha(opacity=38)";    
	  oS.opacity = 40/100;    //透明设置
	  document.body.appendChild(objScreen);
	}
	
	/*关闭模态*/
	function ScreenClean(){
	  var objScreen = document.getElementById("ScreenOver");  
	  var DialogMove = document.getElementById("DialogMove");  
	  if (objScreen){   
	    objScreen.style.display = "none";  
	    objScreen.innerHTML ="";
	    objScreen.parentNode.removeChild(document.getElementById("ScreenOver")); 
	    }
	  if(DialogMove){
	  DialogMove.style.display = "none";
	  DialogMove.innerHTML ="";
	  DialogMove.parentNode.removeChild(document.getElementById("DialogMove"));
	  }    
	}  
		
   /*定义拖动事件*/
	var DragableObj = {
		handle: null,
		dx: 0,
		dy: 0,
		init: function(e) {//初始化
			e = e || event;
			this.handle = e.target || e.srcElement;//这两个是当事件发生时的那个对象引用
			if (this.handle.className.indexOf('drag') == -1) return;
			this.handle = this.handle.parentNode || this.handle.parentElement;
			this.handle.style.position = 'relative';
			if(this.handle.style.left==""&&this.handle.style.top==""){
			this.handle.style.left=0+"px";
			this.handle.style.top=0+"px";
			}
			this.dx = parseInt(this.handle.style.left + 0) - e.clientX;
			this.dy = parseInt(this.handle.style.top + 0) - e.clientY;
			document.onmousemove = DragableObj.drag;
			},
		drag: function(e) {//拖动
			e = e || event;
			//是否有要拖动的对象
			if (this.handle != null) {
			//判断DIV是否在规定范围内
			if(parseInt(this.handle.style.left)<=(maxright+t_Diglogwidth/2)){
			this.handle.style.left = (e.clientX + this.dx) + 'px';
			this.handle.style.top = (e.clientY + this.dy) + 'px';
			}
			else{
			this.handle.style.left = (maxright+t_Diglogwidth/2)-10 + 'px';
			this.handle.style.top = (e.clientY + this.dy) + 'px'; 
			 }
			}
		   },
		drop: function(e) {//拖动停止
			e = e || event;
			//当前拖动对象
			this.handle = e.target || e.srcElement;
			if (this.handle.className.indexOf('drag') == -1) return;
			this.handle = this.handle.parentNode || this.handle.parentElement;
		//DIV是否超出BODY一屏宽度
		if(parseInt(document.documentElement.scrollLeft)!=0){
			this.handle.style.left=0+"px";
			this.handle.style.top=0+"px";
		  }
		  //DIV是否超出指定的宽度
		if(parseInt(this.handle.style.left)>(maxright+t_Diglogwidth/2)){
		    this.handle.style.left=0+"px";
			this.handle.style.top=0+"px";	
		  }
		 document.documentElement.scrollLeft=0+"px";
		 this.handle = null;
		 document.onmousemove = null;
		 }
	}
	
	//事件处理那些元素是不能选定的
	document.onselectstart = function(e) {
		e = e || event;
		eo = e.target || event.srcElement;
		if (eo.className.indexOf('drag') != -1) return false;//只有className="drag"的才能选定
	}
	
	//width 弹出DIV的宽度 弹出DIV的高度
	function Demo(ShowDiv,width,height){	
		document.onmousedown = DragableObj.init;
		document.onmouseup = DragableObj.drop;
        ScreenConvert();
        DialogShow(ShowDiv,width,height);  
	}  
	//	width 弹出DIV的宽度 弹出DIV的高度
   function shows(ShowDiv,width,height){
   		document.onmousedown = DragableObj.init;
		document.onmouseup = DragableObj.drop;
        ScreenConvert();
        DialogShow(ShowDiv,width,height);  
	}  
